// Tree Shaking 只支持 ES Module
import calc from './test-treeShaking.js';
// import inlineModule from 'inline-loader!./test-inlineLoader.js';  loader顺序 {enforce: 'pre'} > 普通loader > inline-loader > {enforce: 'post'}
// import inlineModule from '!inline-loader!./test-inlineLoader.js';  忽略webpack里相应配置的普通loader
// import inlineModule from '-!inline-loader!./test-inlineLoader.js'; 忽略webpack里相应配置的前置loader（pre）和普通loader
// import inlineModule from '!!inline-loader!./test-inlineLoader.js'; 忽略webpack里相应配置的前置loader（pre）,普通loader和后置loader（post）
import './styles/index.less';
import imgSrc from './assets/test.jpg';
import Worker from './encryption.worker.js';

// tree shaking
console.log(calc.sum(1,2));

// scope hosting 
let a = 1;
let b = 2;
let c = 3;
let d = a + b + c;
console.log(d);

// url-loader
let image = document.createElement('img');
image.src = imgSrc;
document.body.appendChild(image);

// Web Worker
let password = "1wscv9gh05456&4Q";
const worker = new Worker();
worker.postMessage(password);
worker.onmessage = function(event){
  console.log(event.data);
};